package com.wingsfrog.puzzle.modules.dao;

import com.wingsfrog.puzzle.modules.entity.Score;
import com.wingsfrog.puzzle.modules.entity.User;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

public interface ScoreDao extends CrudRepository<Score,Integer>{

    @Query("select s.score from Score s where s.userId=?1 and s.gameId=?2")
    public Integer getScore(Integer userId, Integer gameId);

    @Query("update Score s " +
            "set s.score=?3 " +
            "where s.userId=?1 and s.gameId=?2")
    public void updateScore(Integer userId, Integer gameId, Integer score);
}
